package com.ouyy.volunteerservice.volunteer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ouyy.volunteerservice.volunteer.domain.po.Volunteer;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface VolunteerMapper extends BaseMapper<Volunteer> {
    // 如果有特殊的查询需求，可以在这里定义
    @Select("SELECT DATE_FORMAT(registration_date, '%m') AS month, COUNT(*) AS count " +
            "FROM volunteers " +
            "GROUP BY DATE_FORMAT(registration_date, '%m') " +
            "ORDER BY month DESC")
    List<Map<String, Object>> countVolunteersByMonth();

}
